package com.heima.utils.threadLocal;

import com.heima.model.admin.pojos.AdUser;


public class AdThreadLocalUtil {

    private final static ThreadLocal<AdUser> adUserThreadLocal=new ThreadLocal<>();
    public static void setUser(AdUser user)
    {
        adUserThreadLocal.set(user);
    }
    public static AdUser getUser()
    {
        return adUserThreadLocal.get();
    }
    public static void clear()
    {
        adUserThreadLocal.remove();
    }
    public static Integer getUserId(){
        return adUserThreadLocal.get().getId();
    }
    public static void setUserId(Integer userId)
    {
        AdUser user = new AdUser();
        user.setId(userId);
        setUser(user);
    }

}
